From: Hannah von Reth Date: Thu, 20 May 2021 14:45:52 +0000 (+0200) Subject: Fix network drive detection X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~30^2^2~189^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0fa84e960f4fd8c837d031764cb7932b7ee20ae1;p=nextcloud-desktop.git Fix network drive detection We can't rely on the file system detection because Windows is reporting the underlying file system. Fixes: #8272 --- diff --git a/src/common/vfs.cpp b/src/common/vfs.cpp index e887937f0..84df80c76 100644 --- a/src/common/vfs.cpp +++ b/src/common/vfs.cpp @@ -70,10 +70,18 @@ Result Vfs::checkAvailability(const QString &path) const auto mode = bestAvailableVfsMode(); #ifdef Q_OS_WIN if (mode == Mode::WindowsCfApi) { - const auto fs = FileSystem::fileSystemForPath(path); + const auto info = QFileInfo(path); + if (QDir(info.canonicalPath()).isRoot()) { + return tr("The Virtual filesystem feature does not support a drive as sync root"); + } + const auto fs = FileSystem::fileSystemForPath(info.absoluteFilePath()); if (fs != QLatin1String("NTFS")) { return tr("The Virtual filesystem feature requires a NTFS file system, %1 is using %2").arg(path, fs); } + const auto type = GetDriveTypeW(reinterpret_cast(QDir::toNativeSeparators(info.absoluteFilePath().mid(0, 3)).utf16())); + if (type == DRIVE_REMOTE) { + return tr("The Virtual filesystem feature is not supported on network drives"); + } } #else Q_UNUSED(mode)